package com.henry.chatkit.messages.holder

import android.view.View
import android.widget.TextView
import com.henry.chatkit.R
import com.henry.chatkit.messages.MessageInfo

class MessageSystemHolder(itemView: View) : MessageEmptyHolder(itemView) {

    private lateinit var mChatTipsTv: TextView

    override fun getVariableLayout(): Int {
        return R.layout.message_content_system
    }

    override fun initVariableViews() {
        mChatTipsTv = rootView.findViewById(R.id.chat_tips_tv)
    }

    override fun layoutViews(msg: MessageInfo?, position: Int) {
        super.layoutViews(msg, position)

        if (properties.tipsMessageBubble != null) {
            mChatTipsTv.background = properties.tipsMessageBubble
        }
        if (properties.tipsMessageFontColor != 0) {
            mChatTipsTv.setTextColor(properties.tipsMessageFontColor)
        }
        if (properties.tipsMessageFontSize != 0) {
            mChatTipsTv.textSize = properties.tipsMessageFontSize.toFloat()
        }

        mChatTipsTv.text = msg?.text
    }

}